package xyz.mumuwei.youthcourseserver.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * @author mumuwei
 * @date 2022/4/4
 */
@Configuration
@Component
public class AlipayConfig {
    /**
     * '商户appid
     */
    public static String APPID;

    /**
     * 私钥 pkcs8格式的
     */
    public static String RSA_PRIVATE_KEY;

    /**
     * 支付宝公钥
     */
    public static String ALIPAY_PUBLIC_KEY;

    /**
     * 服务器异步通知页面路径
     * 需http://或者https://格式的完整路径，
     * 不能加?id=123这类自定义参数，
     * 必须外网可以正常访问
     */
    public static String NOTIFY_URL;

    /**
     * 页面跳转同步通知页面路径
     * 需http://或者https://格式的完整路径，
     * 不能加?id=123这类自定义参数，
     * 必须外网可以正常访问
     * 商户可以自定义同步跳转地址
     */
    public static String PC_RETURN_URL;

    public static String WAP_RETURN_URL;

    /**
     * 请求网关地址
     */
    public static String URL;

    /**
     * 编码
     */
    public static String CHARSET;

    /**
     * 返回格式
     */
    public static String FORMAT;

    /**
     * RSA2
     */
    public static String SIGNTYPE;

    public static String getAPPID() {
        return APPID;
    }

    @Value("${ycms.alipay.appid}")
    public void setAPPID(String APPID) {
        AlipayConfig.APPID = APPID;
    }

    public static String getRsaPrivateKey() {
        return RSA_PRIVATE_KEY;
    }

    @Value("${ycms.alipay.rsaPrivateKey}")
    public void setRsaPrivateKey(String rsaPrivateKey) {
        RSA_PRIVATE_KEY = rsaPrivateKey;
    }

    public static String getAlipayPublicKey() {
        return ALIPAY_PUBLIC_KEY;
    }

    @Value("${ycms.alipay.alipayPublicKey}")
    public void setAlipayPublicKey(String alipayPublicKey) {
        ALIPAY_PUBLIC_KEY = alipayPublicKey;
    }

    public static String getNotifyUrl() {
        return NOTIFY_URL;
    }

    @Value("${ycms.alipay.notifyUrl}")
    public void setNotifyUrl(String notifyUrl) {
        NOTIFY_URL = notifyUrl;
    }

    public static String getPcReturnUrl() {
        return PC_RETURN_URL;
    }

    @Value("${ycms.alipay.pcReturnUrl}")
    public void setPcReturnUrl(String pcReturnUrl) {
        PC_RETURN_URL = pcReturnUrl;
    }

    public static String getWapReturnUrl() {
        return WAP_RETURN_URL;
    }

    @Value("${ycms.alipay.wapReturnUrl}")
    public void setWapReturnUrl(String wapReturnUrl) {
        WAP_RETURN_URL = wapReturnUrl;
    }

    public static String getURL() {
        return URL;
    }

    @Value("${ycms.alipay.url}")
    public void setURL(String URL) {
        AlipayConfig.URL = URL;
    }

    public static String getCHARSET() {
        return CHARSET;
    }

    @Value("${ycms.alipay.charset}")
    public void setCHARSET(String CHARSET) {
        AlipayConfig.CHARSET = CHARSET;
    }

    public static String getFORMAT() {
        return FORMAT;
    }

    @Value("${ycms.alipay.format}")
    public void setFORMAT(String FORMAT) {
        AlipayConfig.FORMAT = FORMAT;
    }

    public static String getSIGNTYPE() {
        return SIGNTYPE;
    }

    @Value("${ycms.alipay.signtype}")
    public void setSIGNTYPE(String SIGNTYPE) {
        AlipayConfig.SIGNTYPE = SIGNTYPE;
    }

}
